<?php

/**
 * Mensaje filter form base class.
 *
 * @package    sms
 * @subpackage filter
 * @author     Patricio Andrés Córdova De La Cruz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseMensajeFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_plantilla'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plantilla'), 'add_empty' => true)),
      'id_cliente'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cliente'), 'add_empty' => true)),
      'id_sucursal'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Sucursal'), 'add_empty' => true)),
      'usuario_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Usuario'), 'add_empty' => true)),
      'fecha_programada' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'fecha_envio'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'texto_enviado'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numero_enviado'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'id_plantilla'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Plantilla'), 'column' => 'id_plantilla')),
      'id_cliente'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Cliente'), 'column' => 'id_cliente')),
      'id_sucursal'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Sucursal'), 'column' => 'id_sucursal')),
      'usuario_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Usuario'), 'column' => 'usuario_id')),
      'fecha_programada' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'fecha_envio'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'texto_enviado'    => new sfValidatorPass(array('required' => false)),
      'numero_enviado'   => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('mensaje_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Mensaje';
  }

  public function getFields()
  {
    return array(
      'id_mensaje'       => 'Number',
      'id_plantilla'     => 'ForeignKey',
      'id_cliente'       => 'ForeignKey',
      'id_sucursal'      => 'ForeignKey',
      'usuario_id'       => 'ForeignKey',
      'fecha_programada' => 'Date',
      'fecha_envio'      => 'Date',
      'texto_enviado'    => 'Text',
      'numero_enviado'   => 'Text',
    );
  }
}
